﻿#region Using

using Common.Base;
using Common.Enums;

using GameCommon.ComponentInterfaces;
using GameCommon.Components;
using GameCommon.HitBoxes;

using Menu.Components;

using GlobalServices = GameCommon.Services.Service;

#endregion

namespace Menu.Common
{
    internal static class XmlHelper
    {
        /// <summary>
        ///     Gets Dimension for Text components.
        ///     Position inherited from Parent
        ///     Size calculated from letters
        /// </summary>
        /// <param name="text">current text component</param>
        /// <param name="parent">current parent</param>
        /// <returns></returns>
        public static Dimension GetDimension(Text text, GameComponent parent)
        {
            return new Dimension(parent.Position.X, parent.Position.Y, GetSize(text));
        }


        private static Size GetSize(Text text)
        {
            return GlobalServices.FontService.GetSize(text.Value, text.Font);
        }
    }
}